package com.wxp.demo04.start;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;

import com.wxp.demo04.R;
import com.wxp.demo04.util.LogUtils;

/**
 * 1.2.1 Activity的生命周期
 */
public class LifeCycleActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_life_cycle);
        this.setTitle("1.2 Activity的生命周期");

        //对按钮绑定点击事件
        findViewById(R.id.btn_act_next).setOnClickListener(this);

        LogUtils.info(LifeCycleActivity.class.getSimpleName() + " onCreate");
    }

    @Override
    public void onClick(View v) {
        //跳转新界面
        startActivity(new Intent(this, ActFinishActivity.class));
    }

    @Override
    protected void onStart() {
        super.onStart();
        LogUtils.info(LifeCycleActivity.class.getSimpleName() + "  onStart");
    }

    @Override
    protected void onResume() {
        super.onResume();
        LogUtils.info(LifeCycleActivity.class.getSimpleName() + "  onResume");
    }

    @Override
    protected void onPause() {
        super.onPause();
        LogUtils.info(LifeCycleActivity.class.getSimpleName() + "  onPause");
    }

    @Override
    protected void onStop() {
        super.onStop();
        LogUtils.info(LifeCycleActivity.class.getSimpleName() + "  onStop");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        LogUtils.info(LifeCycleActivity.class.getSimpleName() + "  onDestroy");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        LogUtils.info(LifeCycleActivity.class.getSimpleName() + "  onRestart");
    }


}